// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;


const int N = 2e5+50;

int k, n;

int p[N];

const int MOD = 998244353;

int main(int argc, char const *argv[]) {
    // code
    
    vector<int> pos;
    scanf("%d%d", &n, &k);
    LL ans1 = 0, ans2 = 0;
    for (int i=1; i<=n; ++i) {
        scanf("%d", &p[i]);
        if (p[i] >= n-k+1) {
            pos.push_back(i);
            ans1 += p[i];
        }
    }

    int m = sz(pos);
    ans2 = 1;
    for (int i=1; i<m; ++i)
        ans2 = ans2 * (pos[i] - pos[i-1]) % MOD;
    printf("%lld %lld\n", ans1, ans2);



    return 0;
}
